package graph.group.zhangtao.guider.image.view;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import graph.group.zhangtao.guider.NavigationActivity;
import graph.group.zhangtao.guider.R;
import graph.group.zhangtao.guider.getter.ImageGetterFactory;


/**
 * Created by zhangjiakai on 2017/12/26.
 */

public class GuideFragment extends Fragment {

    private String url;
    private String text;
    private TextView textView;
    private ImageView imageView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        url = getArguments().getString("data");
        text = getArguments().getString("text");
    }

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_guide, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        imageView = (ImageView) getView().findViewById(R.id.image);
        textView = (TextView)getView().findViewById(R.id.showText);
//        new ImageGetter(imageView,url).execute();
        ImageGetterFactory.setImageView(imageView,url, NavigationActivity.isLocal());
        textView.setText(text);
    }
}
